<!--doctype html>
<html>
<head>
	<!--- ->
	<meta charset="utf-8" />
	<style>* {
	background-color: #070707;
	color: #bbb;
	font-family: "Courier New";
	font-size: 20px;
	border: 0;
	border-radius: 0;
}

input {
	border-bottom: solid #0061fe;
	transition: 1s;
}

input:focus
{
	border-radius: 10px;
	background-color: #bbb3;
}

button {
	transition: 1s;
}

button:hover
{
	text-shadow: 3px 3px 2px #9ba50eaa;
	color: cde8b5;
	background-color: #6666;
	border-radius: 10px;
}
</style>
	<title>分解因式</title>
</head>

<body>
	<!--- ->
	<div class="inp">
		<input type="number" id="ip" />
		<button onclick="doo();">Done</button>
		<button onclick="ot.innerHTML='';">x</button>
	</div>
	<pre id="ot"></pre>
	<script>i = a => document.getElementById(a);
ot = i("ot");
ip = i("ip");
ott = (a) => {
	ot.innerHTML = `${a}\n${ot.innerHTML}`;
};
doo = () => {
	ipp = ip.value;
	if (isNaN(ipp)) {
		ott("非数错误！");
	} else {
		if (
			(ipp <= 1) ||
			(Math.floor(ipp) != ipp)
		) {
			ott("Waring! ")
		} else {
			a = 1;
			b = [];
			while (a++ < Math.sqrt(ipp)) {
				if (ipp % a == 0) {
					b.push(a);
					b.push(ipp / a);
				}
			}
			if (b.length == 0) {
				ott(`${ipp}可能是个质数`);
			} else {
				b.sort((a, b)=>a-b);
				c = b.join(", ");
				ott(`${ipp}的因数有: ${c}`);
			}
		}
	}
};</script>
</body>
</html>
<!---->
<!doctype html>
<html>
<head>
	<!---->
	<style>* {
	background-color: #070707;
	color: #bbb;
	font-family: "Courier New";
	font-size: 20px;
	border: 0;
	border-radius: 0;
}

input {
	border-bottom: solid #0061fe;
	transition: 1s;
	/*width: 17em;*/
}

input:focus
{
	border-radius: 10px;
	background-color: #bbb3;
	/*width: 32em;*/
}

button {
	transition: 1s;
}

button:hover
{
	text-shadow: 3px 3px 2px #9ba50eaa;
	color: #cde8b5;
	background-color: #6666;
	border-radius: 10px;
}

pre {
	transition: 0.3s;
	opacity: 1;
}</style>
	<title>分解因式</title>
	<meta charset="utf-8" />
</head>

<body>
	<!---->
	<div class="inp">
		<input type="number" id="ip" />
		<button onclick="runn=clsIng?0:doo();" id="doneb">Done</button>
		<button onclick="cls();">x</button>
	</div>
	<pre id="ot"></pre>
	<script>i = a => document.getElementById(a);
ot = i("ot");
ip = i("ip");
clsIng = false;
ott = (a) => {
	ot.innerHTML = `${a}\n${ot.innerHTML}`;
};
doo = () => {
	ipp = ip.value;
	if (isNaN(ipp)) {
		ott("非数错误！");
	} else {
		if (
			(ipp <= 1) ||
			(Math.floor(ipp) != ipp)
		) {
			ott("Waring! ")
		} else {
			a = 0;
			b = [];
			while (a++ < Math.sqrt(ipp)) {
				if (ipp % a == 0) {
					if (a != (ipp / a)) {
						b.push(a);
						b.push(ipp / a);
					} else {
						b.push(a);
					}
				}
			}
			if (
				b.length == 2 ||
				ipp == 2
			) {
				ott(`${ipp}可能是个质数`);
			} else {
				b.sort((a, b)=>a-b);
				c = b.join(", ");
				ott(`${ipp}的因数有: ${c}`);
			}
		}
	}
};
cls = () => {
	clsIng = true;
	ot.style.opacity = 0;
	i("doneb").style.color = "#bbb1";
	setTimeout("ot.innerHTML='';", 350);
	setTimeout(
		() => {
			ot.style.opacity=1;
			clsIng=false;
			i("doneb").style.color = "#bbb";
		},
		400
	);
}</script>
</body>
</html>
<!---->